#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>

#define BUFF 1024

int caesar(char *, int, int );

int kword(char *,char* ,int);

int main(int argc, char **argv)
{
	char *x=malloc(BUFF);
	int key=0;
	if(argc>1)
	{
	
	}
	else
	{
		printf("\nEnter the string:");
		scanf("%[^\n]",x);
		printf("\nEnter the key:");
		scanf("%d",&key);
		if(caesar(x,key,0)>0) printf("%s\n",x);
		if(caesar(x,key,1)>0) printf("%s\n",x);
		else printf("\nError Occured!!\n");
		
	}
	return 0;
}
int caesar(char * str, int k,int op)
{
	int i=0;
	int p=0;
	if(op==1) k=-1*k;
	while(str[i])
	{
		p=str[i];
		if((p>64)&&(p<92))
		{
			p=p+k;
			if(p>91) p-=26;
			if(p<65) p+=26;
		}
		else if((p>96)&&(p<123))
		{
			p+=k;
			if(p>122) p-=26;
			if(p<97) p+=26;			
		}
		else ;
		str[i]=p;
		i++;
	}
	return 1;
		
}

